spb/datacenterindex
Public
HTML 53.9%
TypeScript 44.5%
JavaScript 0.6%
SQL 0.5%
1import { fmtMw, fmtUsd, placeLine } from "@/lib/format";2import { fmtPartialDateSafe } from "@/lib/format-project";3import { STATUS_LABEL } from "@/lib/labels";4import { OG_CONTENT_TYPE, OG_SIZE, renderOg } from "@/lib/og-template";5import { getProject } from "./data";67export const alt = "Data center project — DataCenterIndex";8export const size = OG_SIZE;9export const contentType = OG_CONTENT_TYPE;10export const revalidate = 3600;1112export default async function Image({ params }: { params: Promise<{ slug: string }> }) {13 const { slug } = await params;14 const r = await getProject(slug);15 if (!r.ok) return renderOg({ eyebrow: "Project", title: "Data center project", subtitle: "DataCenterIndex — announced, permitted and under-construction projects." });16 const p = r.data;17 const place = placeLine(p);18 return renderOg({19 eyebrow: "Project",20 title: p.name.length > 90 ? `${p.name.slice(0, 87)}…` : p.name,21 subtitle: [p.operator?.name, place !== "—" ? place : null].filter(Boolean).join(" · ") || undefined,22 stats: [23 { label: "Planned MW", value: p.plannedMw === null ? "—" : `≈ ${fmtMw(p.plannedMw)}` },24 { label: "Investment", value: p.investmentUsd === null ? "—" : fmtUsd(p.investmentUsd) },25 { label: "Status", value: STATUS_LABEL[p.status] },26 { label: "Expected", value: p.expectedOpening ? fmtPartialDateSafe(p.expectedOpening) : "TBD" },27 ],28 });29}30